package com.project.dao.impl;

import java.sql.*;

public class BaseDao {
    protected Connection con;
    protected PreparedStatement ps;
    protected ResultSet rs;

    public BaseDao() {
    }

    public void setConnection() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            this.con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dmsdb?characterEncoding=utf-8", "root", "123456");
        } catch (Exception var2) {
            throw new RuntimeException(var2);
        }
    }

    public void close() {
        try {
            if (this.rs != null) {
                this.rs.close();
            }

            if (this.ps != null) {
                this.ps.close();
            }

            if (this.con != null) {
                this.con.close();
            }

        } catch (SQLException var2) {
            throw new RuntimeException(var2);
        }
    }
}
